package com.tosmart.jorm.annotation;

import java.lang.annotation.*;

/**
 * Entity classes use this tag defines the fields
 * and the associated database table column.
 * <p/>
 * This correlation reflects only the value to the
 * value of the corresponding.
 * <p/>
 * Jorm framework based on a series of @ JormMap
 * definition, you can automatically complete the
 * Entity class field value and the associated
 * database table column value is automatically
 * converted between.
 *
 * @author tosmart@gmail.com
 * @see JormEntity
 * @see JormReferList
 * @see GenerateMethod
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface JormMap {

    /**
     * This tag defines Entity class field with the
     * relational database table column associated
     * with the specified name.
     * <p/>
     * If you do not specify this field, JORM framework
     * will by default use the Entity class field name
     * to uppercase.
     *
     * @return name of the column in database.
     */
    String column() default "";

    /**
     * This tag is specified with the Entity field
     * associated with the database column is a primary
     * key.
     * <p/>
     * Since a table can have more than one primary
     * key column, this tag can be used to describe
     * more than one Entity field.
     * <p/>
     * (default is false)
     *
     * @return if the related column is primary key
     */
    boolean primaryKey() default false;

    /**
     * In the JORM framework, the number fields (including
     * the primary key fields and non-primary key fields)
     * values can be set to automatically increase.
     * <p/>
     * This tag is specified, Entity field value has not
     * been clearly set the value of the case will be JORM
     * framework to set up an automatic increase in its value.
     * <p/>
     * The specific field values of the generation method,
     * is expressed by the GenerateMethod class. default
     * is GenerateMethod.None
     *
     * @return generation method of the field value
     */
    GenerateMethod autoGenerate() default GenerateMethod.None;

    /**
     * When the autoGenerate tag is set as
     * GenerateMethod.Sequence, you need to tie this tag
     * to indicate the name of the Oracle sequence.
     *
     * @return the name of related oracle sequence
     */
    String oracleSequence() default "";
}
